package com.jiankang.askhealth.core.area.service.impl;

import java.util.List;

import com.jiankang.askhealth.core.area.dao.AreaMapper;
import com.jiankang.askhealth.core.area.domain.Area;
import com.jiankang.askhealth.core.area.domain.AreaExample;
import com.jiankang.askhealth.core.area.domain.AreaExample.Criteria;
import com.jiankang.askhealth.core.area.service.AreaService;

public class AreaServiceImpl implements AreaService {
	private AreaMapper areaMapper;
	

	@Override
	public Area getByPk(String areaid) {
		return areaMapper.selectByPrimaryKey(areaid);
	}

	@Override
	public List<Area> getAreasByType(String type) {
		AreaExample example = new AreaExample();
		Criteria criteria = example.createCriteria();
		criteria.andTypeEqualTo(type);
		return areaMapper.selectByExample(example);
	}

	@Override
	public List<Area> getAreasByParentid(String parentid) {
		AreaExample example = new AreaExample();
		Criteria criteria = example.createCriteria();
		criteria.andParentidEqualTo(parentid);
		return areaMapper.selectByExample(example);
	}

	public void setAreaMapper(AreaMapper areaMapper) {
		this.areaMapper = areaMapper;
	}

}
